<?php 
if(!empty($_POST)){
   $color=$_POST['color'];
if($color=='1'){
  echo "<style>p{color:red;}</style>";
}
elseif($color=='2'){
    echo "<style>p{color:yellow;}</style>";
  }
  else{
    echo "<style>p{color:blue;}</style>";
  }
}
?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <p>锄禾日当午，</p>
    <p>汗滴禾下土。</p>
    <p>谁知盘中餐，</p>
    <p>粒粒皆辛苦。</p>
    <form action="" method="post">
   <select name="color" id="">
<option value="1">红色</option>
<option value="2">黄色</option>
<option value="3">蓝色</option>
   </select>
        <input type="submit" value="更改颜色">
    </form>
</body>

</html>